package cn.tl.hrm.client;

import cn.tl.hrm.doc.CourseDoc;
import cn.tl.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class SearchServiceClientFallbackFactory implements FallbackFactory<SearchServiceClient> {
    @Override
    public SearchServiceClient create(Throwable throwable) {
        return new SearchServiceClient(){

            @Override
            public AjaxResult add(CourseDoc doc) {
                throwable.printStackTrace();
                return AjaxResult.me().setSuccess(false).setMessage("搜索服务不可用");
            }
        };
    }
}
